import request from "@/utils/request";

export interface tmItemType {
  id?: number;
  tmName: string;
  logoUrl: string;
}

export type tmLlistType = tmItemType[];

export interface tmInfoType {
  records: tmLlistType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}

export const reqTMList = (page: number, limit: number) => {
  return request.get<null, tmInfoType>(
    `/admin/product/baseTrademark/${page}/${limit}`
  );
};

// Trademark新增
export const reqTMAdd = (trademarkParam: tmItemType) => {
  return request.post<any, null>(
      `/admin/product/baseTrademark/save`,trademarkParam
  );
};

// 新增品牌
export const reqAddTM = (trademarkData: tmItemType) => {
  return request.post<null, null>(
    `/admin/product/baseTrademark/save`,
    trademarkData
  );
};

// 修改品牌
export const reqUpdateTM = (trademarkData: tmItemType) => {
  return request.put<null, null>(
    `/admin/product/baseTrademark/update`,
    trademarkData
  );
};

// 删除某个
export const reqDelTM = (id: number) => {
  return request.delete<null, null>(
    `/admin/product/baseTrademark/remove/${id}`
  );
};

// 请求所有品牌列表
export const reqAllTM = () => {
  return request.get<null, tmLlistType>(
    `/admin/product/baseTrademark/getTrademarkList`
  );
};